﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DataAccess.SqlClient;
using System.Data;
using System.Data.SqlClient;
using Model;
namespace DAL
{
  public  class HealthDAL
    {
        /// <summary>
        /// 健康卡类别
        /// </summary>
        /// <returns></returns>
      public static dynamic HealthTypeshow()
        {
            SqlQuery q = new SqlQuery
            {
                CommandText = "select * from HealthType",
            };
            var dt = SqlDataAccess.ExecDataset(q).Tables[0];//连接数据库，获取健康卡类别
            var list = new List<dynamic>();
            foreach (var dr in dt.Select())
            {
                list.Add(

                    new
                    {
                        HealthTID = dr.Field<Guid>("HealthTID"),
                        InTypes = dr.Field<string>("InTypes"),
                    }
                    );
            }
            return list;
        }

      /// <summary>
      /// 健康卡表
      /// </summary>
      /// <returns></returns>
      public static dynamic Healthshow()
      {
          SqlQuery q = new SqlQuery
          {
              CommandText = "select * from Health where HealthTID=@HealthTID",
          };
          var dt = SqlDataAccess.ExecDataset(q).Tables[0];//连接数据库，获取健康卡表
          var list = new List<dynamic>();
          foreach (var dr in dt.Select())
          {
              list.Add(

                  new
                  {
                      HealthID = dr.Field<Guid>("HealthID"),
                      InImage = dr.Field<string>("InImage"),
                      Title = dr.Field<string>("Title"),
                      Content = dr.Field<string>("Content"),
                      HealthTID = dr.Field<string>("HealthTID"),
                  }
                  );
          }
          return list;
      }
    }
}
